<template>
	<view class="content">

		<view class="">
			<!-- 轮播 -->
			<swiper class="swiper" indicator-color="rgba(255, 255, 255, 0.6)"
				indicator-active-color="rgba(255, 255, 255, 1)" :autoplay="true" :interval="3000" :duration="1000"
				:current="swiperCurrent" circular="true">
				<swiper-item v-for="item in swiperImg" :key="item.vcPicUrl">
					<image class="swiper-item" :src="item.vcPicUrl" mode="heightFix"></image>
				</swiper-item>
			</swiper>
		</view>

		<view class="swiper-list">
			<view>
				<view class="px-3 border-bottom">
					<view class="text-box mb-2" scroll-y="true" style="text-align: center; color:green;">
						<text class="font32">公告栏</text>
					</view>
					<view class="uni-btn-v pb-2 ">
						<view class="notice" v-if="noticeList.length">
							<swiper class="swiper-nav" :circular="true" :vertical="true" :autoplay="true"
								:interval="3000" :duration="3000" style="height: 20px;">
								<swiper-item v-for="(item,index) in noticeList" :key="index">
									<view style="width: 100%;height: 20px;display: table-cell;vertical-align: middle;"
										class="right">{{item.vcTitle}}</view>
								</swiper-item>
							</swiper>
						</view>
					</view>
				</view>
			</view>
		</view>

		<view>
			<uni-list v-if="list.length">
				<uni-list-item v-for="(item,index) in list" :key="index" :ellipsis="1" :title="item.vcTitle" showArrow
					rightText="查看详情" @click="detail(item.longId)" link></uni-list-item>

			</uni-list>

		</view>
	</view>
</template>

<script>
	import uniList from "../../components/uni-list/uni-list.vue"
	import uniListItem from "../../components/uni-list-item/uni-list-item.vue"
	export default {
		data() {
			return {
				swiperImg: [

				],
				none: true,
				current: 0,
				mode: 'default',
				swiperCurrent: 0,
				noticeList: [],
				list: []
			};
		},
		onLoad() {
			this.getBanner();
			this.getData();
		},
		components: {
			uniList,
			uniListItem
		},
		methods: {
			getBanner() {
				let this_ = this;
				let opts = {
					url: 'Mien/findMienXy.shtml'
				};
				let param = {
					longXsId: uni.getStorageSync('classUserId'),
					page: 1,
					pageSize: 20
				};
				this_.$http.httpRequest(opts, param).then(
					res => {
						console.log(res.data);
						if (res.data.code == '200') {
							this_.list = res.data.data;
						} else {
							uni.showToast({
								icon: 'none',
								title: res.data.msg
							});
						}
					},
					error => {
						console.log(error);
					}
				);
			},
			getData() {
				let this_ = this;
				let opts = {
					url: 'Mien/findMienXyTzlb.shtml'
				};
				let param = {
					longXsId: uni.getStorageSync('classUserId')
				};
				this_.$http.httpRequest(opts, param).then(
					res => {
						if (res.data.code == '200') {
							this_.swiperImg = res.data.data.banner;
							this_.noticeList.push(res.data.data.notice);
						} else {
							uni.showToast({
								icon: 'none',
								title: res.data.msg
							});
						}
					},
					error => {
						console.log(error);
					}
				);
			},
			detail(e) {
				console.log(e)
				uni.navigateTo({
					url: '../articleDetail/articleDetail?id=' + e

				})
			}
		}

	}
</script>

<style lang="scss">
	.content {
		.swiper {
			width: 750rpx;
			height: 300rpx;
			border-radius: 16rpx;
			overflow: hidden;
			// margin-top: 16rpx;
			position: relative;
			// margin-left: 26rpx;

			.swiper-item {
				width: 750rpx;
				height: 300rpx;
				border-radius: 16rpx;
			}
		}

		.dots {
			position: absolute;
			top: 220rpx;
			left: 50%;
			transform: translate(-50% 0);
			z-index: 4;
			display: flex;
			justify-content: center;

			.dot {
				width: 24rpx;
				height: 8rpx;
				transition: all .6s;
				background: rgba(0, 0, 0, .3);
				margin-right: 10rpx;
			}

			.active {
				width: 24rpx;
				height: 8rpx;
				background: rgba(255, 255, 255, .8);
			}
		}
	}

	.uni-list-cell-pd {
		padding: 4px 14px;
	}
</style>
